package com.example.moments.dao;

import androidx.room.Dao;
import androidx.room.Query;

import com.example.moments.ssmemo.entity.Comment;

import java.util.List;

@Dao
public interface CommentDao extends BaseDao<Comment> {

    
    @Query("SELECT * FROM " + Comment.TABLE_NAME)
    List<Comment> getAll();

    @Query("SELECT * FROM " + Comment.TABLE_NAME+ " where contentId = :contentId " )
    List<Comment> getAllByContentId(Long contentId);
//    需要father id

    @Query("SELECT * FROM " + Comment.TABLE_NAME + " where id = :id limit 1")
    Comment getById(Long id);

    @Query("SELECT * FROM " + Comment.TABLE_NAME + " WHERE id IN (:ids)")
    List<Comment> loadAllByIds(Long[] ids);

    @Query("DELETE FROM "+Comment.TABLE_NAME)
    void clearAll();
}
